package com.apes.enquiry.product.repository;

import com.apes.enquiry.product.model.Category;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * 类描述：
 *
 * @ClassName CategoryRepository
 * @Description 描述
 * @Author wushilong
 * @Date 2022/10/14 14:04
 * @Version 1.0
 */
public interface SpCategoryRepository extends CustomRepository<Category,String> {

    @Query(value = "select a.name from Category a")
    List<String> findByNameAll();

    Category findByName(String name);

    @Query(value = "select a.name as name from Category a where a.label=1")
    List<Map<String,String>> nameList();
}
